AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')

function ENT:Initialize()
	self.Entity:SetNetworkedBool("heldprop",false)
	// Choose model
	model = "models/healthvial.mdl"
	
	// Initalize physics
	self.Entity:SetModel(model)
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	local phys=self.Entity:GetPhysicsObject()
	phys:SetMass(20)
	if (phys:IsValid()) then phys:Wake() end
end
function ENT:KeyValue(key, value)
	if (self.Entity:IsOutput(key)) then self.Entity:StoreOutput(key,value)
	else self.Entity[key]=value end
end
function ENT:AcceptInput(i, activator, caller)
	me=self.Entity
	if		(i=="Kill") then
		me:Remove()
	end
end
function ENT:Use(activator, caller)
	if (activator:IsPlayer() and caller:IsWorld()) then
		self.Entity:Remove()
		self:TriggerOutput("OnUsed",activator)
		zday.infection.Cure(activator)
	end
end
function ENT:IsOutput(o)
	local OUTPUTLIST = { "OnUsed" }
	local r=false
	for i in pairs(OUTPUTLIST) do
		if (o==OUTPUTLIST[i]) then return true end
	end
	return false
end